<script>
	import Vue from 'vue';
	export default {
		onLaunch: function(e) {
			
			
			if (uni.getStorageSync('data')) {
				uni.switchTab({
					url: '/pages/myTeam/myTeam'
				})
			}
			
			
			console.log('绑定关系: ', e,uni.getStorageSync('data') != ''); //ssss
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					}
					// #endif
					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			});
		},

		onShow: function() {
			this.gettingInfo()
			console.log('uni.getStorageSync()==>', uni.getStorageSync('data') == true);
			if (uni.getStorageSync('data')) {
				uni.switchTab({
					url: '/pages/myTeam/myTeam'
				})
			}
		},
		onHide: function() {
			console.log('App Hide');
		},
		methods: {
			// 获取用户基本信息
			async gettingInfo() {
				const res = await this.$u.get('user/' + uni.getStorageSync('data').id, {}, {});
				if (res.code == 0) {
					uni.switchTab({
						url: '/pages/myTeam/myTeam'
					})
				}
			},
		}
	};
</script>

<style lang="scss">
	/*每个页面公共css */
	//  添加
	//
	// 分支上添加的东西
	@import 'common/colorui/main.css';
	@import 'common/colorui/icon.css';
	@import 'common/colorui/animation.css';
	@import 'common/uview-ui/index.scss';

	uni-page {
		overflow: auto;
	}

	page {

		// background-color: #FFFFFF;
		view {
			font-family: PingFang SC;

			text {
				font-family: PingFang SC;
			}
		}
	}
</style>
